<?php

namespace App\Http\Middleware;

use Closure;

class AdminMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {   
        if(!session('uid')){

         return redirect('/admin/login')->with('error','违规操作,请登录');
        } else {

         return $next($request);
        }
    }
 
}
